<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Config;

class EnforceTenancy
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
//        $env = app(Environment::class);
//
//        if ($fqdn = optional($env->hostname())->fqdn) {
//            config(['database.default' => 'tenant']);
//        }
        Config::set('database.default', 'tenant');

        return $next($request);
    }
}
